<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- <script src="./事件总线.js"></script> -->
  <script src='./消息订阅,发布,取消.js'></script>
</head>

<body>
  <script>
    // evenBus.on('login', data => {
    //   console.log(data + '--正在登录.....')
    // })
    // evenBus.on('login', data => {
    //   console.log(data + "--登录成功.....")
    // })
    // evenBus.on('regsin', data => {
    //   console.log(data + "--注册成功.....")
    // })
    // // setTimeout(() => {
    // //   evenBus.emit('login', '呵呵')
    // // }, 2000)

    // evenBus.off()
    // console.log(evenBus)
    //先订阅再发布
    var food1 = PubBus.subscribe('food', data => {
      console.log('1订阅了food,正在准备----', data)
    })
    var food2 = PubBus.subscribe('food', data => {
      console.log('2订阅了food，正在准备----', data)
    })
    PubBus.subscribe('new', data => {
      console.log('1订阅了new', data)
    })
    PubBus.off('token_2')
    PubBus.publish('food', {
      zhushi: 'rice',
      vegetable: 'kongxincai'
    })
    PubBus.publish('new', {
      study: 'english',
      game: 'xiaomeistart'
    })

    console.log(food1, food2)

    console.log(PubBus)
  </script>
</body>

</html>